#include <iostream>
using std::cout;
using std::endl;

class Base
{
public:
    virtual void print() const
    {
        cout << "Base::print()" << endl;
    }
};


class Derived
: public Base
{
public:
    /* void print() const override */
    /* { */
    /*     cout << "Derived::print()" << endl; */
    /* } */
};

int gNum = 10;

void test0(){
    cout << "&gNum:" << &gNum << endl;

    Base b1;
    long* pb = (long*)(&b1);
    /* cout << *pb << endl; */
    long * pVtable = (long*)(*pb);
    cout << "Base虚表:" << pVtable << endl;

    Base b2;
    long* pb2 = (long*)(&b2);
    long * pVtable2 = (long*)(*pb2);
    cout << "Base虚表:" << pVtable2 << endl;

    Derived d1;
    long * pd = (long*)(&d1);
    long * pv = (long*)(*pd);
    cout << "Derived虚表:" << pv << endl;



    const char * pstr = "hello";
    printf("%p\n",pstr);
}

int main(void){
    test0();
    return 0;
}
